﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ESP;
using TimbreRecognition.Recognition.Model;

namespace TimbreRecognition.Recognition.ESP
{
    public class ESPNetworkCreator
    {

        public ILogger Logger { get; set; }

        public INetwork Create(TrainingSet trainingSet)
        {
            MFCCEnvironment environment = new MFCCEnvironment(trainingSet);

            EspAlgorithm espAlgorithm = new EspAlgorithm();

            if (Logger != null)
            {
                espAlgorithm.Logger = s => Logger.Log(s);
            }
          
            Network network = espAlgorithm.Evoluate(environment);

            ESPNetworkWrapper wrapper = new ESPNetworkWrapper(network);

            return wrapper;
        }
    }
}
